package com.huluobo.a2202mvvm_im_douyindemo.mvpDemo;

/**
 * Created by LC on 2024/4/19.
 */
public class LoginPresenter {
    private LoginModel loginModel = new LoginModel();
    private LoginView loginView;

    public LoginPresenter(LoginView loginView) {
        this.loginView = loginView;
    }

    public void login(String username, String password) {
        UserBean user = loginModel.login(username, password);
        if (user == null) {
            //P层返回失败
            loginView.onFailed("登录失败");
        } else {
            //P层返回成功
            loginView.onSuccess(user);
        }
    }
}
